/***********************************************************
 *  File_Name  : XJExcepction.cpp
 *  File_Path   :
 *  File_Encode : UTF8
 *  Description :
 *
 *  OS : Linux, UNIX
 *  LastVersion  : 20150128
 *
 *  Author      : LiXiujie(李秀杰)
 *  Date        : 2015-1-28
 *  Version     : 20150128
 *  Description :
 *
 *  Edit Author :
 *  Edit Date   :
 *  Version     :
 *  Description :
 *
 ***********************************************************/

#include "XJExcepction.h"

namespace XJUtilClass {

XJExcepction::XJExcepction() {
	// TODO Auto-generated constructor stub
	m_nErrorCode = 0;
}

XJExcepction::~XJExcepction() throw () {
	// TODO Auto-generated destructor stub
	m_nErrorCode = 0;
}

XJExcepction::XJExcepction(const XJExcepction &e){
	m_nErrorCode = e.m_nErrorCode;
	m_strMsg = e.m_strMsg;
}

XJExcepction::XJExcepction(const std::string &strMsg){
	m_nErrorCode = -1;
	m_strMsg = strMsg;
}

void XJExcepction::operator=(const XJExcepction &other){
	if (this != &other){
		m_nErrorCode = other.m_nErrorCode;
		m_strMsg = other.m_strMsg;
	}
}

XJExcepction::XJExcepction(const int &nErrorCode, const std::string &strMsg){
	m_nErrorCode = nErrorCode;
	m_strMsg = strMsg;
}

int XJExcepction::getErrorCode() const{
  return m_nErrorCode;
}

std::string XJExcepction::getMessage() const{
  return m_strMsg;
}

const char *XJExcepction::what() const throw(){
  return m_strMsg.c_str();
}

} /* namespace XJUtilClass */
